package com.ricchieri.manage.bean;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import com.ricchieri.common.BusinessSettings;
import com.ricchieri.util.FacesUtil;

@ManagedBean(name = "addEmailMB")
@ViewScoped
public class AddEmailTemplateManageBean extends CommonEmailTemplateManageBean {
	private static final long serialVersionUID = -2378079122896305921L;
	
	public String getEmailTemplateType() {
		return emailTemplateType;
	}

	public String save() {
		getEmailTemplate().setEmailToSendType(this.obtainEmailType(getEmailTemplateType()));
		emailTemplateService.addTemplate(getEmailTemplate());
		FacesUtil.addParametersFlash(BusinessSettings.KEY_EMAIL_TEMPLATE, getEmailTemplate());
		
		return BusinessSettings.SUCCESS;
	}

	@Override
	public Boolean isRequeriedEmailTemplate() {
		return Boolean.FALSE;
	}
}
